package helper.base.list

object SortListHelper {
    fun <T, R : Comparable<R>> List<T>.sortList(
        ascending: Boolean = true,
        selector: (T) -> R?,
    ): List<T> {
        return if (ascending) {
            this.sortedBy(selector)
        } else {
            this.sortedByDescending(selector)
        }
    }
}